
function test_xml_text()
    local text = [==[
        <html>
        hello
        </html>
        <html>
            <head>
                <![CDATA[hello world]]>
                hello world1
                this is a test
            </head>
            <head key="value"/>
        </html>
        ]==]
        
    local t = commonlib.XmlDecode(text);
    
    print(t, type(t), next(t));
    commonlib.echo(t);
    print(commonlib.XmlEncode(t))
end


function test_xmlnode()
    local xmlnode = {
        name = "value", 

        attr = {
            value = [=[<div><![CDATA[test]]</div>]=]
        },

        [1] = {
            text = [=[<div><![CDATA[test]]fdafdsa<![CDATA[testfsgfs]]</div>]=],
            cdata = true,
        }
    }

    local xmltext = commonlib.XmlEncode(xmlnode)
    print(xmltext)
    commonlib.echo(commonlib.XmlDecode(xmltext))
end

test_xmlnode();